#include <bits/stdc++.h>
#define int long long
using namespace std;
int months[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string get_string(int x) {
	string ans = "";
	if (x < 10) {
		ans += "0";
		ans += (char)(x+'0');
	} else {
		int first = x / 10;
		int second = x % 10;
		ans += (char)(first+'0');
		ans += (char)(second+'0');
	}
	return ans;
}


bool judge(string s) {
	int cnt = 0;
	char last;
	for (auto c : s) {
		if (!cnt) {
			cnt=1; // 第一个字符
		} else {
			// 不是第一个
			if (c == last + 1) {
				// 连上了
				cnt++;
			} else {
				cnt = 1; // 重头开始
			}
		}
		last = c;
		if (cnt >= 3) {
			return true;
		}
	}
	return false;
}

signed main(){
	string year_string = "2022";
	int cnt = 0;
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= months[i]; j++) {
			string res = year_string + get_string(i) + get_string(j);
			if (judge(res)) {
				cnt++;
			}
		}
	}
	cout << cnt << '\n';
}
